#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QMessageBox>

#include "gdal_priv.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_pushButtonDem_clicked();

    void on_pushButtonClass_clicked();

    void on_pushButtonHabitat_clicked();

    void on_pushButtonResult_clicked();

    void on_pushButtonInfo_clicked();

    void on_pushButtonOk_clicked();

    void on_pushButtonCancel_clicked();

private:
    Ui::MainWindow *ui;
    QMessageBox msgBox;
    int blockSize;

    void initResult(GDALRasterBand *demBand, GDALRasterBand *classBand, GDALRasterBand *resultBand);
    void *initDataBlock(GDALDataType type, int size);
    int getData(void* data, GDALDataType type, int idx);
    GDALDataset *rasterize(OGRGeometry *geometry, int xSize, int ySize, double *geoTrans);
    void updateHabitat(GDALRasterBand *demBand, GDALRasterBand *classBand, GDALRasterBand *resultBand, GDALRasterBand *tmpBand,
                       OGRFeature *feature, int blockSize, int xOffset, int yOffset);
    int checkHabitat(OGRFeature* feature, int demValue, int classValue);
};
#endif // MAINWINDOW_H
